@extends('layout.index')
@section('title','后台商品添加')

@section('content')
<script type="text/javascript" charset="utf-8" src="/Adstyle/baidu/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/Adstyle/baidu/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/Adstyle/baidu/lang/zh-cn/zh-cn.js"></script>


<div class="row">
    <div class="col-lg-8">
        <h1 class="page-header">商品添加</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>

<div class="row">
	
    <div class="col-lg-8 ">
    	<div class="panel panel-default">						<div class="panel-heading">	
    			<!-- 显示内存中的错误信息 -->
    			<!-- @if(session('error'))
    			<div class="alert alert-danger alert-dismissable">
                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                    {{session('error')}}
                </div>
                @endif -->

                @if (count($errors) > 0)
				    <div class="alert alert-danger">
				        <ul>
				            @foreach ($errors->all() as $error)
				                <li>{{ $error }}</li>
				            @endforeach
				        </ul>
				    </div>
				@endif
    		</div>		

    		<div class="row">
    		<div class="col-lg-2"></div>
    			  <div class="col-lg-8 ">
    			<br>
			<form role="form" action="{{url('/admin/goods/insert')}}" method="post" enctype="multipart/form-data">
				 <div class="form-group">
                    <label>商品分类</label>
                    <select name="cate_id" class="form-control">
                        <option value="0">顶级分类</option>
                    @foreach($cates as $k=>$v)
                        <option value="{{$v->id}}">{{$v->name}}</option>
                    @endforeach
                    </select>
                </div>
			    <div class="form-group">
			        <label>商品名</label>
			        <input type="text" name="title" value="{{old('username')}}" class="form-control">
			    </div>
			    <div class="form-group">
			        <label>商品价格</label>
			        <input type="text" name="price" value="{{old('username')}}" class="form-control">
			    </div>
			    <div class="form-group">
			        <label>商品库存</label>
			        <input type="text" name="kucun" value="{{old('username')}}" class="form-control">
			    </div>
			   
			    <div class="form-group">
			        <label>商品详情</label>
			       	 <script id="editor" name="content" type="text/plain" style="width:500px;height:300px;">222222</script>
			    </div>
			      

			    <div class="form-group">
			        <label>商品图片</label>
			        <input type="file" name="pic">
			    </div>
			    {{csrf_field()}}
			    <button class="btn btn-primary " type="submit">添加</button>
			    <button class="btn btn-warning " type="reset">重置</button>
			</form>
			</div>
			</div>
			<br>
	</div>
   </div>
</div>
<script type="text/javascript">
    var ue = UE.getEditor('editor',{toolbars: [
    ['fullscreen', 'source', 'undo', 'redo'],
    ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
	]});
</script>
@endsection